const { DataTypes } = require('sequelize');
const sequelize = require('../db/seq');

const Order = sequelize.define('learn_order', {
  user_id: {
    type: DataTypes.INTEGER,
    allowNull: false,
    Comment: '用户id'
  },
  address_id: {
    type: DataTypes.INTEGER,
    allowNull: false,
    Comment: '地址id'
  },
  goods_info: {
    type: DataTypes.TEXT,
    allowNull: false,
    Comment: '商品信息'
  },
  total: {
    type: DataTypes.DECIMAL(10, 2),
    allowNull: false,
    Comment: '订单总金额'
  },
  order_number: {
    type: DataTypes.CHAR(18),
    allowNull: false,
    Comment: '订单号'
  },
  status: {
    type: DataTypes.TINYINT,
    allowNull: false,
    defaultValue: 0,
    Comment: '订单状态 0:待支付 1:已支付 2:已发货 3:已签收 4:已取消 '
  },


});
// Order.sync({ force: true })

module.exports = Order;
